home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
oppopwin.zip
/
OPPOPWIN.DOC
< prev
next >
Wrap
Text File
|
1992-03-31
|
8KB
|
218 lines
***************************************************************************
* *
* POPWINDOW Version 1.0 *
* Dated : 03/06/92 *
* Author : Hans Otten *
* *
* The latest version, allong with the author, can always *
* be found at the LONDON PC USERS GROUP BBS (519-472-9471) *
* located in London, Ontario. (Canada that is ...) *
* *
****************************************************************************
Introduction
------------
OPPOPWIN was my first attempt to use Object Professional To create my
own descendant object instead of just declaring instances of ones. The
OPPOPWIN unitdeclares an object called PopWindow which is a pop up
window that is displayed on the screen. The reason for writing this
object was two fold. First off, I found it very frustrating to write
a pop up menu using the OPMENU unit in Object Professional. Secondly,
before I used OP I was usin TecknoJock's Turbo Toolkit. One of the
units in this toolkit was MENUTTT5 which had a simple menu that I could
use. Therefore, when I moved over to OP, I descided to duplicate the
menu system for my own use.
As you might have noticed, this release is version 1.0, which means
it probably still has some bugs in it. It is also missing some key features
that are common to most of OP's objects, most notably error handling and
stream support. As I become more familiar with OOP and Object Professional,
I hope to improve upon this code.
Legality and Junk
-----------------
Before I start into the documentation, I have to put this little
statement in for my own peace of mind. I (Hans Otten) assume no
responsability for any loss or damage caused by this program. This code
is being released to the public domain as FreeWare. You may modify the code,
hack it, or use it in any capacity you see fit. All I ask is that, if you
make any substantial changes to the code, please drop me a note on one
of the following places.
- In the Pascal Conference of I'Net.
- At the London PC Users Group BBS (519) 472-9471.
- Rose Media BBS (416) 733-2285.
Or if you prefer to write, send me a letter at :
272 Homestead Crescent
London, Ontario
N6G 2E5
Canada.
On to the Documentation
-----------------------
-------------
| CONSTANTS |
-------------
KeyMax = 120;
- Maximum # of keys in keyset used by the POPWINDOW Command set
MaxNumPicks = 20;
- Maximum number of selections in one menu (This can be modified)
MaxTopicLen = 80;
- Maximum length of each topic in the menu (This can also be modified)
ccScrollWin = ccUser50;
- Command in command set to allow the window to be moved somewhere else.
Ident : String[15] = 'Popwin Key Set';
KeySet : Array[0..KeyMax] of Byte = (.....)
CfgEnd : Byte = 0;
- A defined keyset to be used with the PopWindow.
AllowSet : Array[1..2] of Set of Char =
(['1','2','3','4','5','6','7','8','9'],
['A'..'Z']);
- The two defined sets of lead in characters for each menu topic.
PopWindowFrame : FrameArray = '▀'+' '+'▀'+' '+
'▀'+' '+' '+' ';
- My own unique window frame for the PopWindow.
The next four contants are options which affect the PopWindow's
operations.
ppStick = $0001;
- Stick on menu selections. When the user selects a menu topic with the
mouse, if the topic is not highlighted, then the highlight bar will move
to it, but not act upon it.
ppCapitalize = $0002;
- Capitalize the current highlighted menu choice. PopWindow will
temporarily convert the highlighted topic to all capital letters.
ppUseLetters = $0004;
- By default PopWindow uses numbers as lead ins to each topic, however
you can force PopWindow to use Letters by wnabling this option. Note
that if there are more than 9 topics in the menu, PopWindow will
automatically switch over to letters.
ppAllowEsc = $0008;
- Allow the user to exit the menu by pressing ESC. If this option is not
turned on, then pressing ESC will just move the highlight bar to the
last option in the current menu.
DefPopWindowOptions = 0;
- Default window options.
---------
| TYPES |
---------
PopWindowPtr = ^PopWindow;
PopWindow =
Object(CommandWindow)
...
End;
-------------
| VARIABLES |
-------------
PopCommands : CommandProcessor;
-----------
| METHODS |
-----------
Function GetTopicNum(TopicId : Byte) : Byte;
- All topics in the menu have a TopicID which you define. This function
returns the location in the menu of TopicId. If TopicId does not exist,
it will return 0.
Function GetTopicId(TopicNum : Byte) : Byte;
- This function does the exact opposite of GetTopicNum. GetTopicId will
return the TopicID of TopicNum. If TopicNum is not a location in the
menu, 0 is retuned.
Constructor Init(X1, Y1, X2, Y2:Byte; NumHeaders : Byte; Var Colors : ColorSet);
- The Constructor takes as coordinates the size of the menu, # of headers
you want to add at the top of the meny (Maximum of 2), and a color set.
Procedure AddHeaders(H1,H2 : String);
- This procedure will add up to 2 headers to the top of the menu. note
that Init automatically expands the menu in order to incorporate
the headers.
Procedure AddTopic(TopicName : String; TopicId : Byte);
- This procedure should be used to add a topic to the menu. It takes as
input the Name of the topic (As it will be displayed on the menu),
and a unique TopicID by which you can identify it by.
Procedure SetDefaultChoice(TopicId : Byte);
- Set the default choice to start on when the process method is called.
Note, when PopWindow is initialized, it automaticallys sets itself to
the first choice added with AddTopic.
Function GetLastChoice : Byte;
- Return the last selection by user, returns the choice ID.
Function GetMaxChoices : Byte;
- Return total number of entries in menu.
Procedure GetCoordinates(Var X1, Y1, X2, Y2 : Byte);
- Get the coordinates of the menu.
Procedure SetPadLength(Len : Byte);
- Sets the number of spaces between the left margin and the topics.
Note that the minimum value is 4.
Procedure SetSelectorChar(CH : Char);
- Sets the character to be written in the left margin when the
current topic is highlighted. By default this character is ""
Function ppOptionsAreOn(SelOptions : Word) : Boolean;
- Determine what option(s) are turned on.
Procedure ppOptionsOn(SelOptions : Word);
- Turn selected option(s) on
Procedure ppOptionsOff(SelOptions : Word);
- Turn selected option(s) off
Procedure ScrollWindow(XT,YT,XB,YB : Byte);
- Move the menu to another location, within the defined boundaries given.
This procedure uses the Arrow keys to move the window, and the ENTER
or ESC key to exit the procedure.
Procedure ChangeTopic(TopicNum : Byte; NewTopic : String; RedrawMenu : Boolean);
- Change the topic description. RedrawMenu askes if the whole menu should
be redrawn or not.
Procedure RemoveTopic(TopicNum : Byte; MoveRemaining : Boolean);
- Remove a topic from the menu. MoveRemaining will shift all remaining topics
up one notch and redraw the menu.
Procedure SwitchTopics(Topic1, Topic2 : Byte);
- Swith the topic entries for 2 topics.
Procedure Draw; Virtual;
- Draw the menu.
Procedure Process; Virtual;
- Process the menu commands.